//
//  UIView+Helper.h
//  Qicai
//
//  Created by eims on 15/6/6.
//  Copyright (c) 2015年 7ien. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, UIViewAlignment)
{
    UIViewAlignmentLeft = 1 << 0,
    UIViewAlignmentRight = 1 << 1,
    UIViewAlignmentTop = 1 << 2,
    UIViewAlignmentBottom = 1 << 3,
    
    UIViewAlignmentLeftEdge = 1 << 5,
    UIViewAlignmentRightEdge = 1 << 6,
    UIViewAlignmentTopEdge = 1 << 7,
    UIViewAlignmentBottomEdge = 1 << 8,
    
    UIViewAlignmentHorizontalCenter = 1 << 9,
    UIViewAlignmentVerticalCenter = 1 << 10,
};

@interface UIView (Helper)

@property (nonatomic, assign, readonly, getter=getMinY) CGFloat minY;

@property (nonatomic, assign, readonly, getter=getMidY) CGFloat midY;

@property (nonatomic, assign, readonly, getter=getMaxY) CGFloat maxY;

@property (nonatomic, assign, readonly, getter=getMinX) CGFloat minX;

@property (nonatomic, assign, readonly, getter=getMidX) CGFloat midX;

@property (nonatomic, assign, readonly, getter=getMaxX) CGFloat maxX;

@property (nonatomic, assign, readonly, getter=getWidth) CGFloat width;

@property (nonatomic, assign, readonly, getter=getHeight) CGFloat height;

@property (nonatomic) CGFloat golf_left;        ///< 相当于 frame.origin.x.
@property (nonatomic) CGFloat golf_top;         ///< 相当于 frame.origin.y
@property (nonatomic) CGFloat golf_right;       ///< 相当于 frame.origin.x + frame.size.width
@property (nonatomic) CGFloat golf_bottom;      ///< 相当于 frame.origin.y + frame.size.height
@property (nonatomic) CGFloat golf_width;       ///< 相当于 frame.size.width.
@property (nonatomic) CGFloat golf_height;      ///< 相当于 frame.size.height.
@property (nonatomic) CGFloat golf_centerX;     ///< 相当于 center.x
@property (nonatomic) CGFloat golf_centerY;     ///< 相当于 center.y
@property (nonatomic) CGPoint golf_origin;      ///< 相当于 frame.origin.
@property (nonatomic) CGSize  golf_size;        ///< 相当于 frame.size.

/** 创建一张纯色图片 */
- (UIImage *)imageWithColor:(UIColor *)color;

/** 截图 */
- (UIImage *)golf_snapshotImage;

@end
